﻿@model IEnumerable<WebSoftSeo.Models.Consult>
@using WebSoftSeo.Models
@{
    WebSoftSeoEntities db = new WebSoftSeoEntities();
    var consult = db.Consults.Where(m => m.ParentID == null && m.Status == true).OrderByDescending(c => c.ID).ToList();
    var list = db.Consults.ToList();
}
@if (consult != null)
{
    foreach (var item in consult)
    {
    <div class="testCons">
        <p class="dateCons">@string.Format("{0:dd/MM/yyy HH:mm:ss tt}", item.Date) --- @item.Title</p>
        <p class="titleCons">@item.Contents</p>
        @{
        var listlevel2 = list.Where(m => m.ParentID == item.ID).OrderByDescending(c => c.ID).ToList();
        }
        @foreach (var lv2 in listlevel2)
        {
            <p class="replyCons">Trả lời: @lv2.Contents</p>
        }
    </div>
    }
}